//
//  This file is part of Siena, a wide-area event notification system.
//  See http://www.inf.usi.ch/carzaniga/siena/
//
//  Author: Giovanni Toffetti Carughi
//  See the file AUTHORS for full details. 
//
//  Copyright (C) 2007, 2011 Giovanni Toffetti Carughi
//
//  Siena is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//  
//  Siena is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//  
//  You should have received a copy of the GNU General Public License
//  along with Siena.  If not, see <http://www.gnu.org/licenses/>.
//
package basic.dvdrp;

import java.util.ArrayList;
import java.util.List;

import basic.SENP;


public class SetQueue implements PacketQueue {
	
	int packetCount = 0;
	int size = 0;
	public static int DEFAULT_SIZE = 50;
	
	ArrayList queuedPackets;
	ArrayList dequeuedPackets;
	
	public SetQueue() {
		this.size = DEFAULT_SIZE;		
		queuedPackets = new ArrayList(size);	
		dequeuedPackets = new ArrayList(size);
	}
	
	public SetQueue(int size) {
		this.size = size;		
		queuedPackets = new ArrayList(size);	
		dequeuedPackets = new ArrayList(size);
	}	

	public void add(byte[] obj) throws Exception {
		// create packets if needed		
		synchronized(dequeuedPackets){
			while(dequeuedPackets.isEmpty() && packetCount == size){
				dequeuedPackets.wait();
			}
		}

	}

	public void add(byte[] obj, int length) throws Exception {
		// TODO Auto-generated method stub

	}

	public void clear() {
		// TODO Auto-generated method stub

	}

	public int next(byte[] buf) {
		// TODO Auto-generated method stub
		return 0;
	}

}
